package cn.kgc.service.impl;

import cn.kgc.dao.JobDao;
import cn.kgc.pojo.Branch;
import cn.kgc.pojo.Job;
import cn.kgc.pojo.position;
import cn.kgc.service.JobService;
import com.github.pagehelper.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class JobServiceImpl implements JobService {

    @Resource
    private JobDao jobDao;

    @Override
    public Job selectById(int id) {
        return jobDao.selectById(id);
    }

    @Override
    public Page<Job> page(int posId, String posType, String startTime, String endTime) {
        return jobDao.page(posId, posType, startTime, endTime);
    }

    @Override
    public List<position> select() {
        return jobDao.select();
    }

    @Override
    public boolean add(int brId, String joType, int joCount, int posId, String registrant, String startTime, String endTime, String jobDescribe, String jobRequire) {
        if (jobDao.add(brId, joType, joCount, posId, registrant, startTime, endTime, jobDescribe, jobRequire) > 0) {
            return true;
        }
        return false;
    }

    @Override
    public List<Branch> selectBr() {
        return jobDao.selectBr();
    }

    @Override
    public boolean updJob(int id, int brId, String joType, int joCount, int posId, String registrant, String startTime, String endTime, String jobDescribe, String jobRequire) {
        if (jobDao.updJob(id, brId, joType, joCount, posId, registrant, startTime, endTime, jobDescribe, jobRequire) > 0) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public boolean delJob(int id) {
        if (jobDao.delJob(id) > 0) {
            return true;
        } else {
            return false;
        }
    }

}

